package com.tools.generator.service.impl;

import cn.hutool.db.PageResult;
import com.tools.common.utils.DateUtils;
import com.tools.generator.entity.BaseClassEntity;
import com.tools.generator.entity.qo.Query;
import com.tools.generator.mapper.BaseClassMapper;
import com.tools.generator.service.BaseClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 基类管理实现
 * @author Admin
 */
@Service
public class BaseClassServiceImpl implements BaseClassService {

    @Autowired
    private BaseClassMapper baseClassMapper;

    @Override
    public List<BaseClassEntity> page(BaseClassEntity query) {
        return baseClassMapper.selectGenBaseClassList(query);
    }

    @Override
    public List<BaseClassEntity> getList() {
        return baseClassMapper.selectList();
    }

    @Override
    public BaseClassEntity getById(Long id) {
        return baseClassMapper.getById(id);
    }

    @Override
    public int save(BaseClassEntity entity) {
        entity.setCreateTime(DateUtils.getNowDateTimeString());
        return baseClassMapper.save(entity);
    }

    @Override
    public void updateById(BaseClassEntity entity) {
        baseClassMapper.updateGenBaseClass(entity);
    }

    @Override
    public void removeBatchByIds(List<Long> list) {
        baseClassMapper.deleteGenBaseClassByIds(list);
    }
}
